<ui:composition xmlns="http://www.w3.org/1999/xhtml"
 	 xmlns:h="http://java.sun.com/jsf/html"      
     xmlns:f="http://java.sun.com/jsf/core"
     xmlns:p="http://primefaces.org/ui"
     xmlns:ui="http://java.sun.com/jsf/facelets"
	 template="index.xhtml">
 <ui:define name="body">
 <script type="text/javascript">
	$(document).ready(function(){		
			$(".submenu-active").removeClass('submenu-active');
			$("#pointDeVente").addClass('submenu-active');
		});
	</script>
  <f:view>
  <h:form id="form"> 
  	<h1>Points de vente</h1>
  	<table width="100%" class="nostyle">
  		<tr>
			<td>
				<h3>Liste des points de vente</h3><!-- class="tit" -->
			</td>
    	</tr>
    </table>
    <table width="100%" class="tit">
    	<tr>
    		<td class="no_border">
    			<p class="t-justify"> 
                <p:inputText/>	
                <p:button id="b" icon="ui-icon-search" style="font-size:12.5px"/>  
				</p>
    		</td>
    		<td class="no_border">
    			<p class="t-justify">
               		<p:commandButton value="Créer un point de vente" style="font-size: 0.9em" action="#{ptVenteMB.getpointDeVenteForm}" ajax="false" />
                </p>
    		</td>
    		<td class="no_border">
    			<p class="t-justify">   
			        <h:commandLink>   
			            <p:graphicImage value="images/iconExcel.png" />  
			        </h:commandLink>  
			        <h:commandLink>  
			            <p:graphicImage value="images/pdf.png" />  
			        </h:commandLink>  
			        <h:commandLink>  
			            <p:graphicImage value="images/imprimante.png" />  
			        </h:commandLink>  
	       		</p>
    		</td>
    	</tr>
    </table>
    <br></br>
	<br></br>
    <p:dataTable  id="pointDeVenteTable"
      			   widgetVar="pointDeVenteTable"
     			   var="pointDeVente"
      			   value="#{ptVenteMB.pointDeVentes}"  
      			   rowKey="#{pointDeVente.id}"
                   selection="#{ptVenteMB.selectedPointDeVente}" 
                   selectionMode="single"
				   paginator="true"  
				   paginatorPosition="bottom"   
                   rows="10" 
                   style="width:100%"> <!-- ;margin-left: 10%;margin-right:10%; -->
        <p:column>  
          <f:facet name="header">Enseigne</f:facet>
          <h:outputText value="#{pointDeVente.enseigne.nom}" />
        </p:column>  
        <p:column>  
          <f:facet name="header">Nom</f:facet>
          <h:outputText value="#{pointDeVente.nom}" />
        </p:column>  
        <p:column>  
          <f:facet name="header">Numéro</f:facet>
          <h:outputText value="#{pointDeVente.numero}" />
        </p:column>  
  
        <p:column>  
          <f:facet name="header">Adresse</f:facet>
          <h:outputText value="#{pointDeVente.adresse}" />
        </p:column>  
  
        <p:column>  
			<f:facet name="header">Code postal</f:facet>
            <h:outputText value="#{pointDeVente.codepostal}" />       
        </p:column>  
        
  		<p:column>  
  			<f:facet name="header">Ville</f:facet>
            <h:outputText value="#{pointDeVente.ville}" />   
        </p:column> 
        
        <p:column>  
          <f:facet name="header">Cadencé</f:facet>
          <p:selectBooleanCheckbox value="#{pointDeVente.candenced}" disabled="true"/>
        </p:column> 
        
        <p:column style="width:45px">
            <p:commandButton id="editPtVte" action="#{ptVenteMB.edit}" title="Editer" icon="ui-icon-pencil"  style="font-size:9px" >
             <f:setPropertyActionListener target="#{ptVenteMB.selectedPointDeVente}" value="#{pointDeVente}" />
            </p:commandButton>
	        <p:commandButton id="deleteButton" onclick="deleteDialog.show()" title="Supprimer" icon="ui-icon-circle-close"  style="font-size:9px">
	        	<f:setPropertyActionListener value="#{pointDeVente}" target="#{ptVenteMB.selectedPointDeVente}" /> 
	        </p:commandButton> 
        </p:column> 
    </p:dataTable>
  		<p:confirmDialog  id="deleteValidation" header="Suppression" severity="alert" resizable="false" 
   		    widgetVar="deleteDialog" modal="true" showEffect="explode" hideEffect="explode"
      		message="Etes vous sur de vouloir supprimer le point de vente #{pointDeVente.nom}?">  
       <div align="right">  <p:commandButton id="cancel" value="Annuler" onclick="deleteDialog.hide()" type="button" />
      	   <p:commandButton id="deletePointDeVente" value="Supprimer" update=":form:pointDeVenteTable" oncomplete="deleteDialog.hide()" actionListener="#{ptVenteMB.deletePointDeVente}"/>
      	</div>
	   </p:confirmDialog> 

  </h:form>
  </f:view>
</ui:define>
</ui:composition>